package com.education.welco.feign;


import com.education.common.pojo.SysAppUser;
import com.education.common.utils.ApiReturnObject;
import com.education.welco.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;


@FeignClient(value = "user-service")
@Service
public interface userFeign {

    @RequestMapping(value = "k12main/sysUser/addAppUser2", method = RequestMethod.POST)
    public ApiReturnObject addStu(@RequestBody SysAppUser appUser);


    @RequestMapping(value = "k12main/sysUser/addAppUser3", method = RequestMethod.GET)
    public ApiReturnObject addAppUser3(@RequestParam(value = "sysPhone") String sysPhone,
                                       @RequestParam(value = "classId") String classId,
                                       @RequestParam(value = "schoolId") Integer schoolId,
                                       @RequestParam(value = "idcardno", required = false) String idcardno,
                                       @RequestParam(value = "sysRelname") String sysRelname,
                                       @RequestParam(value = "sysType",required = false) Integer sysType);

    /**
     *
     * @param sysPhone
     * @param sysPassword
     * @param schoolId
     * @param tId 教务主任id
     * @param teacherName
     * @return
     */
    @RequestMapping(value = "k12main/sysUser/addUser", method = RequestMethod.GET)
    public ApiReturnObject addUser(@RequestParam(value = "sysPhone") String sysPhone,
                                   @RequestParam(value = "sysPassword") String sysPassword,
                                   @RequestParam(value = "schoolId") Integer schoolId,
                                   @RequestParam(value = "tId") Integer tId,
                                   @RequestParam(value = "teacherName") String teacherName
    );

    @RequestMapping(value = "k12main/sysUser/delApp", method = RequestMethod.POST)
    public ApiReturnObject delApp(@RequestBody SysAppUser appUser);


    @RequestMapping(value = "k12main/sysUser/updateByUserId", method = RequestMethod.POST)
    public int updateByUserId(@RequestParam("userId") Integer userId);

    @RequestMapping(value = "k12main/sysUser/delPCUser", method = RequestMethod.GET)
    public ApiReturnObject delPCUser(@RequestParam("userId") Integer userId);

    @RequestMapping(value = "k12main/sysUser/updateApp", method = RequestMethod.POST)
    public ApiReturnObject updateStu(@RequestBody SysAppUser appUser);

    @RequestMapping(value = "k12main/sysUser/findByUserId", method = RequestMethod.GET)
    Map<String, Object> findByUserId(@RequestParam("userId") Integer userId);

    @RequestMapping(value = "k12main/sysUser/findUserBySchoolId", method = RequestMethod.GET)
    boolean findUserBySchoolId(@RequestParam("phone") String phone);

    @RequestMapping(value = "k12main/sysUser/findUserBySchoolId2", method = RequestMethod.GET)
    boolean findUserBySchoolId2(@RequestParam("phone") String phone);

    @RequestMapping(value = "k12main/sysUser/findSysUserBysysPhone", method = RequestMethod.GET)
    public ApiReturnObject findSysUserBysysPhone(@RequestParam("phone") String phone);

    @RequestMapping(value = "k12main/sysUser/updatePC2", method = RequestMethod.GET)
    public ApiReturnObject updateStuPC(@RequestParam("userId") Integer userId,
                                       @RequestParam("classId") Integer classId);

    @RequestMapping(value = "k12main/sysUser/updateTea", method = RequestMethod.GET)
    public ApiReturnObject updateTea(@RequestParam("userId") Integer userId,
                                     @RequestParam("phone") String phone);

    /**
     * 根据部门查询老师
     */
    @RequestMapping(value = "k12main/sysUser/listAddRoom", method = RequestMethod.GET)
    public List<Map> listAddRoom(@RequestParam(value = "deptId") Integer deptId,
                                 @RequestParam(value = "userId") Integer userId
    );

    @RequestMapping(value = "k12main/sysUser/selectUserById", method = RequestMethod.GET)
    User selectUserById(@RequestParam(value = "userId") Integer userId);

    @RequestMapping(value = "k12main/sysUser/updatePassword", method = RequestMethod.GET)
    Integer updatePassword(@RequestBody User user);
}
